<?php echo $this->element('displayHeader'); ?>
<?php echo $ajax->form('Supplier', 'post', array('id' => 'formMain', 'update'=>'content', 'indicator' => 'indicator', 'url'=> array('action'=>'save'))); ?>

<div class="toolbar">
    <div id="tLeft">
        <?php if ($mode == 'add') : ?>
            <?php echo $this->element('toolbar', array('buttons' => array('save', 'clear', 'back'))); ?>
        <?php else : // mode edit ?>
            <?php echo $this->element('toolbar', array('buttons' => array('save', 'add', 'refresh_view',
                    array('delete' => array('model' => 'Supplier', 'title' => 'name')), 'back', 'view_as_supplier'))); ?>
        <?php endif; ?>
    </div>
    <div id="tRight"><?php echo $this->element('neighbors', array('model' => 'Supplier', 'title' => 'name')); ?></div>
</div>

<fieldset>
    <legend>Vendor Information</legend>
    <table>
        <tbody>
            <tr>
                <?php echo $form->input("Supplier.id"); ?>
                <td width="150px"><?php echo $form->label("Supplier.code", "Code", array('class' => 'required')) ?></td>
                <td><?php echo $form->text("Supplier.code", array('maxlength' => 3, 'size' => 5)) ?> </td>
            </tr>
            <tr>
                <td><?php echo $form->label("Supplier.name", "Name", array('class' => 'required')) ?></td>
                <td><?php echo $form->text("Supplier.name", array('size' => 50)) ?> </td>
            </tr>
            <tr>
                <td><?php echo $form->label('Supplier.email', 'Vendor Email'); ?></td>
                <td>
                    <?php echo $form->text('Supplier.email', array('size' => '30')); ?>
                </td>
            </tr>
            <tr>
                <td><?php echo $form->label("Supplier.special_part_no", 'Special Part no') ?></td>
                <td><?php echo $form->checkbox("Supplier.special_part_no") ?> Yes/No </td>
            </tr>
        </tbody>
    </table>
</fieldset>
<fieldset>
    <legend>Vendor Address</legend>
    <table style="width: 600px">
        <tbody>
            <tr>
                <td class="top"><?php echo $form->label("Supplier.contract", 'Contract') ?></td>
                <td colspan="3"><?php echo $form->text('Supplier.contract', array('class' => 'wide')) ?></td>
            </tr>
            <tr>
                <td class="top"><?php echo $form->label("Supplier.address", 'Address') ?></td>
                <td colspan="3"><?php echo $form->textarea('Supplier.address', array('rows' => 2, 'cols' => 50, 'class' => 'wide')) ?></td>
            </tr>
            <tr>
                <td><?php echo $form->label("Supplier.province_id", 'Province') ?></td>
                <td width="200px"><?php echo $form->select("Supplier.province_id", $provinces) ?> </td>
                <td width="120px"><?php echo $form->label("Supplier.zipcode", 'Zipcode') ?></td>
                <td><?php echo $form->text("Supplier.zipcode", array('size'=>5,'maxlength'=>5)) ?></td>
            </tr>
            <tr>
                <td><?php echo $form->label("Supplier.tel", 'Tel.') ?></td>
                <td><?php echo $form->text("Supplier.tel") ?></td>
                <td><?php echo $form->label("Supplier.fax", 'Fax') ?></td>
                <td><?php echo $form->text("Supplier.fax") ?></td>
            </tr>
        </tbody>
    </table>
</fieldset>

<?php echo $form->end(); ?>
<?php if ($mode == 'edit') : ?>
<div id="divCustomerSupplier">
        <?php echo $this->requestAction('suppliers/contract_view/' . $this->data['Supplier']['id'], array('return')); ?>
</div>
<?php endif; ?>